﻿using Wx.Sdk.MiniProgram.Base;
using Wx.Sdk.MiniProgram.Options;
using Wx.Sdk.MiniProgram.Src;
using Wx.Sdk.Cache;

namespace Wx.Sdk.MiniProgram
{
    public sealed class WxMiniProgram
    {
        internal MiniProgramOption appOption;
        internal IHttpClientFactory httpClientFactory;
        internal MiniProgramBase appBase;
        IMiniProgramLogin _appLogin;
        IMiniProgramQrCode _appQrCode;
        internal IWxCache wxCache;
        public WxMiniProgram(MiniProgramOption options, IHttpClientFactory httpClientFactory,IWxCache wxCache)
        {
            appOption = options;
            this.wxCache = wxCache;
            this.httpClientFactory = httpClientFactory;
            appBase = new MiniProgramBase(this);
        }
        private WxMiniProgram()
        {
        }
        public IMiniProgramLogin AppLogin
        {
            get
            {
                if (_appLogin == null)
                {
                    this._appLogin = new MiniProgramLogin(this);
                }
                return _appLogin;
            }
        }
        public IMiniProgramQrCode AppQrCode
        {
            get
            {
                if (_appLogin == null)
                {
                    this._appQrCode = new MiniProgramQrCode(this);
                }
                return _appQrCode;
            }
        }
    }
}
